﻿namespace KinonekoSoftware.CodariaDB.Documents.Index
{
    public sealed class RegionCache : _Lockable, IEquatable<RegionCache>
    {

        public string ParentID { get; set; }
        public int    Depth    { get; set; }


        public bool Equals(RegionCache other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Id == other.Id;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((RegionCache)obj);
        }

        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }
    }
}